home *** CD-ROM | disk | FTP | other *** search
/ Logiciels PC Special 3 / Logiciel PC - Hors-Serie 3.iso / Logs / micros / ql / outils / qltoolsq / source / docs / format < prev    next >
Text File  |  1995-09-21  |  4KB  |  81 lines

  1. QL disks Format by Paul Foley
  2.  
  3.     What exactly do you want to know?  I don't know about the
  4. 3.2MB format, but I can tell you about 720k.  Allocation blocks are 3
  5. sectors long (normally.  This can be changed) and the block 0
  6. (consisting of sectors 0, 3 and 6 of side 0 on cylinder 0) contains
  7. the mapping info.  The first 96 bytes are used as follows:
  8.        OFFSET  SIZE           VALUE
  9.     $00    .L        $514C3541
  10.     $04    10 bytes    disk label
  11.     $0E    .W        random number (created by FORMAT)
  12.     $10    .L        #writes to this disk
  13.     $14    .W        #free sectors
  14.     $16    .W        #good sectors
  15.     $18    .W        total sectors
  16.     $1A    .W        #sectors per track (9)
  17.     $1C    .W        #sectors per cylinder (18 for DS)
  18.     $1E    .W        number of cylinders (80)
  19.     $20    .W        size of allocation block (3)
  20.     $22    .W        block number for end-of-directory
  21.     $24    .W        byte number of end-of-directory
  22.     $26    .W        sector offset/cylinder
  23.     $28    18 bytes    logical-to-physical sector mapping table
  24.     $3A    18 bytes    physical-to-logical sector mapping table
  25.     $4C    20 bytes    unused
  26.  
  27. The rest of the block consists of pairs of 12-bit values (24 bits for
  28. each block on a fully formatted, 80 track, double sided disk) the
  29. first of which contains the file number which that block belongs to,
  30. the seconds holds the position of this block within that file.  Some
  31. special file numbers are used for the mapping block itself ($F80),
  32. unused blocks ($FDF), bad blocks ($FEF) and non-existant blocks ($FFF)
  33. and the block-number of unused, bad and non-existant blocks is always
  34. $FFF (but when a file is deleted, only the top byte is set to $FD)
  35. the map is $F80 000 - it consists of one block!  The directory
  36. is file number $000, and all other files have numbers corresponding to
  37. their positions in the directory (file $001 is the first, $002 is the
  38. second, etc.)
  39.     The "logical-to-physical sector mapping table" contains a byte
  40. for each sector on a cylinder (18) corresponding to the physical
  41. sector number (0 to 8, with the MSB set for sectors on side 1) for
  42. each logical file sector.  This table is always "0 3 6 128 131 134 1 4
  43. 7 129 132 135 2 5 8 130 133 136" (unless someone has changed it)
  44. meaning sectors 0, 3, 6 of side 0 are used first, then sectors 0, 3, 6
  45. of side 1, then sectors 1, 4, 7 of side 0, etc.  _BUT_ the sector
  46. number is offset by an amount depending on the cylinder number (the
  47. numbers above are correct for cylinder 0, but the "sector
  48. offset/track" value is added (mod 9) for each cylinder.  This value is
  49. usually 5, so the table values are correct again at cylinder 9)
  50.     The "physical-to-logical sector mapping table" contains 9
  51. entries for each side of the disk, containing the logical sector
  52. numbers of the physical sectors on the disk.  It is "0 6 12 1 7 13 2 8
  53. 14" for side 0 and "3 9 15 4 1 16 5 11 17" for side 1 (that is, for
  54. side 0, phys. sector 0 contains log. sector 0, phys. sector 1 contains
  55. log. sector 6, ...) again, this is affected by the "sector
  56. offset/track".
  57.  
  58.     The directory consists of 64 '0's ($30 bytes, not $00 bytes.
  59. I don't know what they're for) followed by a 64 byte entry for each
  60. file, in the following format:
  61.        OFFSET  SIZE           USE
  62.     $00    .L        file length
  63.     $04    .B        unused
  64.     $05    .B        file type
  65.     $06    .L        dataspace (for exec'able programs)
  66.     $0A    .L        unused
  67.     $0E    .W        length of file name
  68.     $10    36 bytes    file name
  69.     $34    .L        file update date
  70.     $38    .L        unused.  Supposed to be reference date.
  71.     $3C    .L        unused.  Supposed to be backup date.
  72.  
  73. The first 64 bytes in the first block of each file contains a copy of
  74. the directory entry, but most of the information in it is not correct
  75. (the name is OK, though)
  76.  
  77.     Hope that helps.
  78.  
  79.                             - Paul
  80.  
  81.